home *** CD-ROM | disk | FTP | other *** search
/ Loadstar 83 / 083.d81 / i-message source < prev    next >
Text File  |  2022-08-26  |  3KB  |  273 lines

  1. ;**** instant message ****
  2. ;completely relocatable
  3. ;by Jeff Jones
  4. ;(c) 1991 Softdisk Publishing
  5. ; sys line,mess col,message$,box col,["active keys"]
  6. ;addr+7 for screen stash
  7. ;addr+374 for screen restore
  8.  
  9. .dis
  10. .org $c000
  11. .mem
  12. ;obj "@0:i-message.o"
  13.  
  14. lda #0
  15. sta 249
  16. sec
  17. bcs line'links
  18.  
  19. screen'stash'entry lda #255
  20. sta 249
  21. bne screen'stash
  22.  
  23. line'links ldy #24
  24. - lda 217,y
  25. ora #128
  26. sta 217,y
  27. dey
  28. bpl -
  29.  
  30. ;**** SCREEN STASH ****
  31.  
  32. screen'stash sei
  33. ldx #0
  34. lda 1
  35. sta 250
  36. stx 1
  37. lda #$d8     ;high byte of dest screen
  38. stx 253
  39. sta 254;  dest screen
  40. lda 648
  41. sta 252;  source screen
  42. ldy #0
  43. sty 251
  44.  
  45. ;begin copying
  46.  
  47. - lda (251),y
  48. sta (253),y
  49. iny
  50. bne -
  51. inx
  52. inc 254
  53. inc 252
  54.  
  55. cpx #4
  56. bne -
  57. ldx #0
  58.  
  59. lda #>55296
  60. sta 252
  61.  
  62. - dec 1            ; roms all in
  63. lda (251),y
  64. inc 1              ; roms all out
  65. sta (253),y
  66. iny
  67. bne -
  68. inc 252
  69. inc 254
  70. inx
  71. cpx #4
  72. bne -
  73.  
  74. lda 250
  75. sta 1
  76. cli
  77.  
  78. bit 249
  79. bvc begin
  80. rts
  81.  
  82. begin jsr $aefd      ;get line number
  83. jsr $ad8a
  84. jsr $b7f7
  85. lda $14
  86. sta 254
  87. and #31
  88. bne +
  89. lda #1         ; too low
  90. sta 254
  91. + cmp #24
  92. bcc +
  93. lda #23        ;too high
  94. + sta 253
  95.  
  96. tax
  97. ldy #0    
  98. clc
  99. jsr $fff0      ;move to message line
  100. ldy #37
  101. lda #32        ; load a space
  102. - sta (209),y  ;clear portion of line
  103. dey
  104. cpy #1
  105. bne -
  106.  
  107. jsr $aefd      ; get message color
  108. jsr $ad8a
  109. jsr $b7f7
  110. lda $14
  111. sta 646
  112.  
  113. jsr $aefd       ;get message
  114. jsr $ad9e
  115. jsr $b6a3
  116.  
  117. beq abort      ;Say!  Where's da message?
  118.  
  119. pha            ;stash message length
  120. ldx $22 ;_{SHIFT-*}{SHIFT-*}{SHIFT-*}{SHIFT-*}{SHIFT-*}{SHIFT-*}{SHIFT-*}{SHIFT-*}{SHIFT-*}{SHIFT-*}{SHIFT-*}{SHIFT-*}{SHIFT-*}{SHIFT-*}{SHIFT-*}{SHIFT-*}
  121. stx 251 ; message location
  122. ldx $23 ;_{SHIFT-*}{SHIFT-*}{SHIFT-*}{SHIFT-*}{SHIFT-*}{SHIFT-*}{SHIFT-*}{SHIFT-*}{SHIFT-*}{SHIFT-*}{SHIFT-*}{SHIFT-*}{SHIFT-*}{SHIFT-*}{SHIFT-*}{SHIFT-*}
  123. stx 252
  124. lsr            ;divide length by 2
  125. sta 253
  126. lda #20
  127. sec
  128. sbc 253        ;center
  129. tay
  130. bit 254        ;check center bit (64)
  131. bvc +          ;Well then DON'T center
  132. ldy #0
  133. + lda 254
  134. and #31
  135. tax
  136. clc
  137. jsr $fff0      ;move to message line
  138. pla            ;remember message length
  139. sta 253
  140. ldy #0
  141. - lda (251),y
  142. jsr $ffd2      ;print the message
  143. iny
  144. cpy 253
  145. bne -
  146. beq +
  147.  
  148. abort rts
  149.  
  150. + jsr $aefd       ;get box color
  151. jsr $ad8a
  152. jsr $b7f7
  153. lda $14
  154. sta 646
  155. lda 254           ;get line number
  156. and #31           ;chop off center bit
  157. tax
  158. dex               ;move up one line
  159. ldy #1
  160. clc
  161. jsr $fff0         ; move to upper left
  162. lda #176
  163. jsr $ffd2         ;print upper left
  164. ldy #36
  165. lda #"{SHIFT-*}"
  166. - jsr $ffd2       ; print top line
  167. dey
  168. bne -
  169. lda #174          ;print upper right
  170. jsr $ffd2
  171. inc 214           ; increment line
  172. lda #1
  173. sta 211
  174. jsr 58732         ;plot
  175. lda #"{SHIFT--}"    
  176. jsr $ffd2         ;print vertical bar
  177. lda #38
  178. sta 211
  179. jsr 58732
  180. lda #"{SHIFT--}"
  181. jsr $ffd2
  182.  
  183. inc 214           ;down and over
  184. lda #1
  185. sta 211
  186. jsr 58732
  187. lda #173
  188. jsr $ffd2         ;print bottom left
  189. ldy #36
  190. lda #"{SHIFT-*}"
  191. - jsr $ffd2       ;print bottom line
  192. dey
  193. bne -
  194. lda #189
  195. jsr $ffd2         ;print bottom right
  196.  
  197. jsr $aefd       ;get active keys
  198. jsr $ad9e
  199. jsr $b6a3
  200. beq abort
  201. sta 253
  202. ldx $22
  203. stx 251
  204. ldx $23
  205. stx 252
  206.  
  207. getkey jsr $ffe4
  208. beq getkey
  209.  
  210. ldy #0
  211. - cmp (251),y      ;cmp active keys
  212. bne +
  213. beq key'buffer     ;match found
  214. + iny
  215. cpy 253
  216. bne -
  217. beq getkey         ;nothing
  218.  
  219. key'buffer sta 631
  220. lda #1
  221. sta 198
  222.  
  223. screen'restore lda 53265
  224. bpl screen'restore
  225.  
  226. sei
  227. ldx #0
  228. lda 1
  229. sta 250
  230. stx 1
  231. lda #$d8;         high byte of source screen
  232. stx 253
  233. sta 254;  source screen
  234. lda 648
  235. sta 252;  dest screen
  236. ldy #0
  237. sty 251
  238.  
  239. ;begin copying
  240.  
  241. - lda (253),y
  242. sta (251),y
  243. iny
  244. bne -
  245. inx
  246. inc 254
  247. inc 252
  248.  
  249. cpx #4
  250. bne -
  251. ldx #0
  252.  
  253. lda #>55296
  254. sta 252
  255.  
  256. - lda (253),y
  257. dec 1
  258. sta (251),y
  259. inc 1
  260. iny
  261. bne -
  262. inc 252
  263. inc 254
  264. inx
  265. cpx #4
  266. bne -  
  267.  
  268. lda 250
  269. sta 1
  270. cli
  271.  
  272. rts
  273.